<!DOCTYPE html>
<!-- saved from url=(0036)http://ep.zjenpu.com/memberfahuo.asp -->
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
    <meta content="telephone=no" name="format-detection">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>防控系统-扫码发货</title>
    <link rel="stylesheet" href="http://at.alicdn.com/t/font_358083_b5ib40a1walfecdi.css">
    <link rel="stylesheet" href="/css/scan.css">
    <script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
    <style>
        .right{
            font-size: 0.6rem;
            text-align:center;
            display: inline;
            padding: 0 0;
            border: #00a0e9 solid 1px;
            background: #00a0e9;
            width: 10%;
            border-radius: 3px;
            color: #ffffff;
            overflow: hidden;
            float: right;

        }
        .left{
            float: left;
        }
    </style>
</head>

<body>
<div class="top">
    <a href="{{urlHome('index','getIndex')}}" class="back" id="deleteBtn" onclick="">&nbsp;<i
                class="icon iconfont icon-back"></i>返回</a>
    <span id="btnNewCode" onclick="">点击录入新单</span>
    <a href="javascript:;" class="logout" id="manualBtn" onclick="" style="display:none">手输</a></div>
<div class="box">
    <!--<div id="manualPlane" class="input-row">-->
    <!--<input type="text" placeholder="请填写要绑定的防伪码" name="code" id="code" class="input" value="">-->
    <!--<input type="button" id="updatejf" class="button" value="添加" onclick="">-->
    <!--</div>-->
    <form action="" method="post">
        <div class="main">
            <div class="mobile">
                订单号： <span>{{$orderSn or ''}}</span>
            </div>
            <div class="saomiao" id="scanQRCodeBtn" onclick="">开始扫描</div>
        </div>
        <div id="queryPlane" class="input-row">
            <input type="text" placeholder="订单号" name="QueryKey" id="QueryKey" class="input" value="{{$orderSn or ''}}">
            <input type="button" id="btnQuery" class="button" value="查询" onclick="">
        </div>
        <div class="list">
            <ul>
                {{--<li><span class="left">货单号： <input type="text" name="code[]" value="MNTP4444644"></span><span class='right' onclick="del(this)">删除</span></li>--}}
                {{--<li><span>货单号： <input type="text" name="code[]" value="NSBY0009090"></span><span class='right' onclick="del(this)">删除</span></li>--}}
                {{--<li><span>货单号： <input type="text" name="code[]" value="HO894488988"></span><span onclick="del(this)">删除</span></li>--}}
                {{--<li><span>货单号： <input type="text" name="code[]" value="KGU25558285"></span><span onclick="del(this)">删除</span></li>--}}
                {{--<li><span>货单号： <input type="text" name="code[]" value="JQIG5518181"></span><span onclick="del(this)">删除</span></li>--}}
                {{--<li><span>货单号： <input type="text" name="code[]" value="XO566688688"></span><span onclick="del(this)">删除</span></li>--}}
                {{--<li><span>货单号： <input type="text" name="code[]" value="XYB77779797"></span><span onclick="del(this)">删除</span></li>--}}
                {{--<li><span>货单号： <input type="text" name="code[]" value="FVDS1113931"></span><span onclick="del(this)">删除</span></li>--}}
            </ul>
        </div>
        <div class="footer">
            <input id="completeBtn" type="button" value="完成">
        </div>
    </form>
    <div class="scroll-area-list" id="codelListArea"></div>
    <!--<div class="page" page="1">加载更多</div>-->
    <div class="scroll-area-list" id="CodeList"></div>
    <div class="__blank__"></div>
    <div style="height: 52px"></div>

</div>
<script type="text/javascript" src="/static/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="/static/js/layer/layer.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">


        function del(_this)
        {
            layer.confirm('确定删除?',{btn:['确定','取消']},function(){
                $(_this).parent().remove();
                layer.closeAll();
            },function(){

            });

        }


    wx.config({!!$config!!});
    //分享朋友圈
    function saoma() {
        // 9.1.2 扫描二维码并返回结果
        wx.scanQRCode({
            needResult: 1,
            desc: '扫描商品条形码',
            success: function (res) {
                //判断扫码是否成功
                if (res.errMsg == 'scanQRCode:ok') {
                    //扫码成功
                    code = res.resultStr;
                    code = code.substring(code.indexOf(',') + 1);
                    $('.list ul').prepend('<li><span class="left">货单号： <input type="text" name="code[]" value="' + code + '"></span><span onclick="del(this)" class="right">删除</span></li>')
                } else {
                    alert('扫描失败，请稍后再试');
                }
            },
            cancel: function () {
                window.history.go(-1);
            }
        });
    }

    wx.error(function (res) {
        alert('参数错误');
    });


    window.getData = function (param, callback) {
        $.ajax({
            type: param.type || 'POST',
            url: param.url,
            data: param.data,
            cache: param.cache || false,
            dataType: 'json',
            success: function (data) {
                if (data.errorCode) {
                    alert('错误' + data.errorCode)
                }
                callback && callback(data)
            }
        })
    }

    //点击查询
    $('#btnQuery').on('touchend', function () {
        var order_sn = $('#QueryKey').val();
        if (order_sn.length < 10) {
            layer.msg('该订单号不存在');
        }
        getData({type: 'get', url: '{{urlHome('order','getCheckOrderSn')}}', data: {order_sn: order_sn}}, function (data) {
            if (data.status == 200) {
                $('#queryPlane').hide()
                $('.main').show();
                $('.mobile span').text(tel)
            } else {
                layer.msg('该订单号不存在');
            }
        })
    })


    //    //点击查询
    //    $('#btnQuery').on('touchend', function () {
    //        var tel = $('#QueryKey').val();
    //        var reg = /^1(3|4|5|7|8)\d{9}$/;
    //        if ((reg.test(tel))) {
    //            getData({type: 'get', url: 'sendGoods/isExistsMobile', data: {mobile: tel}}, function (data) {
    //                if (data.status == 200) {
    //                    $('#queryPlane').hide()
    //                    $('.main').show();
    //                    $('.mobile span').text(tel)
    //                } else {
    //                    layer.msg('该手机号不存在');
    //                }
    //            })
    //        } else {
    //            layer.msg('请输入正确的手机号码');
    //        }
    //    })
    //点击扫描
    $('#scanQRCodeBtn').on('touchend', function () {
        saoma();
    })
    //点击头部录入新单
    $('.top span').on('touchend', function () {
        $('.list ul').html('');
        $('.main').hide();
        $('#QueryKey').val('')
        $('#queryPlane').show()
    })
    //点击完成
    $('#completeBtn').on('touchend', function () {
        //自定页
//        layer.open({
//            type: 1,
//            title:'请填写物流信息',
//            skin: 'layui-layer-demo', //样式类名
//            closeBtn: 0, //不显示关闭按钮
//            anim: 2,
//            area: ['80%', '50%'], //宽高
//            shadeClose: false, //开启遮罩关闭
//            content:
//            '<div style="padding-top:10px;">'+
//            '<input name="shipping_company" id="shipping_company" style="margin:20px;width: 80%; height: 36px;" placeholder="请输入快递公司"></div>'+
//            '<div style="padding-top:10px;">'+
//            '<input name="shipping_code" id="shipping_code" style="margin:20px;width: 80%; height: 36px;" placeholder="请输入快递单号"></div>'+
//            '<div style="">'+
//                    '<a style="margin-left: 40%;border: solid; border-color: #1E9FFF;background-color: #1E9FFF;color: #fff;" id="fahuo">确定</a></div>'
//
//
//        });


        var l = $('.list li').length
        if (l <= 0) {
            layer.msg('请至少录入一条订单');
            return false
        }
        var data = $("form").serialize();
        getData({type: 'post', url: '{{urlHome('order','postSendGoods')}}', data: data}, function (res) {
            layer.msg(res.msg);
            if (res.status == 200) {
//                $('#queryPlane').hide()
//                $('.main').show();
//                $('.mobile span').text(tel)
                layer.prompt({title: '请输入快递公司名称', formType: 0}, function(shipping_company, index){
                    layer.close(index);
                    layer.prompt({title: '请输入快递单号', formType: 0}, function(shipping_code, index){
                        layer.close(index);
                        var shippingdata = {shipping_company : shipping_company,shipping_code:shipping_code,codeList:res.codeList,id:res.id};
                        getData({type: 'post', url: '{{urlHome('order','postChangeOrderStatus')}}', data: shippingdata}, function (result) {
                            layer.msg(result.msg);
                        });
                    });
                });
            }
        })

    })


    $("#fahuo").click(function() {
        var shipping_company = $("#shipping_company").val();
        var shipping_code = $("#shipping_code").val();
        layer.msg(shipping_company);
        layer.msg(shipping_code);
    });

</script>
</body>
</html>